<cfcomponent output="false">

	<cffunction name="read" output="false" access="public" returntype="slr.components.cfgenerated.Medicao_Detail.PontoInteresseBean">
		<cfargument name="id" required="true">
		<cfset var qRead="">
		<cfset var obj="">

		<cfquery name="qRead" datasource="BRUST">
			select 	medicaoId, pontoInteresseId, tipoEstruturaId, tipoOcupacao, distancia, rotulo, 
					radiacaoPrimaria, vizinhanca, fatorUsoId, fatorOcupacaoId
			from dbo.PontoInteresse
			where pontoInteresseId = <cfqueryparam cfsqltype="CF_SQL_INTEGER" value="#arguments.id#" />
		</cfquery>

		<cfscript>
			obj = createObject("component", "slr.components.cfgenerated.Medicao_Detail.PontoInteresseBean").init();
			obj.setmedicaoId(qRead.medicaoId);
			obj.setpontoInteresseId(qRead.pontoInteresseId);
			obj.settipoEstruturaId(qRead.tipoEstruturaId);
			obj.settipoOcupacao(qRead.tipoOcupacao);
			obj.setdistancia(qRead.distancia);
			obj.setrotulo(qRead.rotulo);
			obj.setradiacaoPrimaria(qRead.radiacaoPrimaria);
			obj.setvizinhanca(qRead.vizinhanca);
			obj.setfatorUsoId(qRead.fatorUsoId);
			obj.setfatorOcupacaoId(qRead.fatorOcupacaoId);
			return obj;
		</cfscript>
	</cffunction>



	<cffunction name="create" output="false" access="public" returntype="void">
		<cfargument name="bean" required="true" type="slr.components.cfgenerated.Medicao_Detail.PontoInteresseBean">
		<cfset var qCreate="">

		<cfset var qGetId="">

		<cfset var local0=arguments.bean.getmedicaoId()>
		<cfset var local2=arguments.bean.gettipoEstruturaId()>
		<cfset var local3=arguments.bean.gettipoOcupacao()>
		<cfset var local4=arguments.bean.getdistancia()>
		<cfset var local5=arguments.bean.getrotulo()>
		<cfset var local6=arguments.bean.getradiacaoPrimaria()>
		<cfset var local7=arguments.bean.getvizinhanca()>
		<cfset var local8=arguments.bean.getfatorUsoId()>
		<cfset var local9=arguments.bean.getfatorOcupacaoId()>

		<cfquery name="qCreate" datasource="BRUST">
			insert into dbo.PontoInteresse(medicaoId, tipoEstruturaId, tipoOcupacao, distancia, rotulo, radiacaoPrimaria, vizinhanca, fatorUsoId, fatorOcupacaoId)
			values (
				<cfqueryparam value="#local0#" cfsqltype="CF_SQL_INTEGER" null="#iif((local0 eq ""), de("yes"), de("no"))#" />,
				<cfqueryparam value="#local2#" cfsqltype="CF_SQL_INTEGER" null="#iif((local2 eq ""), de("yes"), de("no"))#" />,
				<cfqueryparam value="#local3#" cfsqltype="CF_SQL_BIT" null="#iif((local3 eq ""), de("yes"), de("no"))#" />,
				<cfqueryparam value="#local4#" cfsqltype="CF_SQL_FLOAT" null="#iif((local4 eq ""), de("yes"), de("no"))#" />,
				<cfqueryparam value="#local5#" cfsqltype="CF_SQL_VARCHAR" />,
				<cfqueryparam value="#local6#" cfsqltype="CF_SQL_BIT" null="#iif((local6 eq ""), de("yes"), de("no"))#" />,
				<cfqueryparam value="#local7#" cfsqltype="CF_SQL_VARCHAR" />,
				<cfqueryparam value="#local8#" cfsqltype="CF_SQL_INTEGER" null="#iif((local8 eq ""), de("yes"), de("no"))#" />,
				<cfqueryparam value="#local9#" cfsqltype="CF_SQL_INTEGER" null="#iif((local9 eq ""), de("yes"), de("no"))#" />
			)
		</cfquery>

		<!--- If your server has a better way to get the ID that is more reliable, use that instead --->
		<cfquery name="qGetID" datasource="BRUST">
			select pontoInteresseId
			from dbo.PontoInteresse
			where medicaoId = <cfqueryparam value="#local0#" cfsqltype="CF_SQL_INTEGER" null="#iif((local0 eq ""), de("yes"), de("no"))#" />
			  and tipoEstruturaId = <cfqueryparam value="#local2#" cfsqltype="CF_SQL_INTEGER" null="#iif((local2 eq ""), de("yes"), de("no"))#" />
			  and tipoOcupacao = <cfqueryparam value="#local3#" cfsqltype="CF_SQL_BIT" null="#iif((local3 eq ""), de("yes"), de("no"))#" />
			  and distancia = <cfqueryparam value="#local4#" cfsqltype="CF_SQL_FLOAT" null="#iif((local4 eq ""), de("yes"), de("no"))#" />
			  and rotulo = <cfqueryparam value="#local5#" cfsqltype="CF_SQL_VARCHAR" />
			  and radiacaoPrimaria = <cfqueryparam value="#local6#" cfsqltype="CF_SQL_BIT" null="#iif((local6 eq ""), de("yes"), de("no"))#" />
			  and vizinhanca = <cfqueryparam value="#local7#" cfsqltype="CF_SQL_VARCHAR" />
			  and fatorUsoId = <cfqueryparam value="#local8#" cfsqltype="CF_SQL_INTEGER" null="#iif((local8 eq ""), de("yes"), de("no"))#" />
			  and fatorOcupacaoId = <cfqueryparam value="#local9#" cfsqltype="CF_SQL_INTEGER" null="#iif((local9 eq ""), de("yes"), de("no"))#" />
			order by pontoInteresseId desc
		</cfquery>
		<cfscript>
			arguments.bean.setpontoInteresseId(qGetID.pontoInteresseId);
		</cfscript>
	</cffunction>



	<cffunction name="update" output="false" access="public" returntype="void">
		<cfargument name="bean" required="true" type="slr.components.cfgenerated.Medicao_Detail.PontoInteresseBean">
		<cfset var qUpdate="">

		<cfquery name="qUpdate" datasource="BRUST" result="status">
			update dbo.PontoInteresse
			set medicaoId = <cfqueryparam value="#arguments.bean.getmedicaoId()#" cfsqltype="CF_SQL_INTEGER" null="#iif((arguments.bean.getmedicaoId() eq ""), de("yes"), de("no"))#" />,
				tipoEstruturaId = <cfqueryparam value="#arguments.bean.gettipoEstruturaId()#" cfsqltype="CF_SQL_INTEGER" null="#iif((arguments.bean.gettipoEstruturaId() eq ""), de("yes"), de("no"))#" />,
				tipoOcupacao = <cfqueryparam value="#arguments.bean.gettipoOcupacao()#" cfsqltype="CF_SQL_BIT" null="#iif((arguments.bean.gettipoOcupacao() eq ""), de("yes"), de("no"))#" />,
				distancia = <cfqueryparam value="#arguments.bean.getdistancia()#" cfsqltype="CF_SQL_FLOAT" null="#iif((arguments.bean.getdistancia() eq ""), de("yes"), de("no"))#" />,
				rotulo = <cfqueryparam value="#arguments.bean.getrotulo()#" cfsqltype="CF_SQL_VARCHAR" />,
				radiacaoPrimaria = <cfqueryparam value="#arguments.bean.getradiacaoPrimaria()#" cfsqltype="CF_SQL_BIT" null="#iif((arguments.bean.getradiacaoPrimaria() eq ""), de("yes"), de("no"))#" />,
				vizinhanca = <cfqueryparam value="#arguments.bean.getvizinhanca()#" cfsqltype="CF_SQL_VARCHAR" />,
				fatorUsoId = <cfqueryparam value="#arguments.bean.getfatorUsoId()#" cfsqltype="CF_SQL_INTEGER" null="#iif((arguments.bean.getfatorUsoId() eq ""), de("yes"), de("no"))#" />,
				fatorOcupacaoId = <cfqueryparam value="#arguments.bean.getfatorOcupacaoId()#" cfsqltype="CF_SQL_INTEGER" null="#iif((arguments.bean.getfatorOcupacaoId() eq ""), de("yes"), de("no"))#" />
			where pontoInteresseId = <cfqueryparam value="#arguments.bean.getpontoInteresseId()#" cfsqltype="CF_SQL_INTEGER">
		</cfquery>
	</cffunction>



	<cffunction name="delete" output="false" access="public" returntype="void">
		<cfargument name="bean" required="true" type="slr.components.cfgenerated.Medicao_Detail.PontoInteresseBean">
		<cfset var qDelete="">

		<cfquery name="qDelete" datasource="BRUST" result="status">
			delete
			from dbo.PontoInteresse
			where pontoInteresseId = <cfqueryparam cfsqltype="CF_SQL_INTEGER" value="#arguments.bean.getpontoInteresseId()#" />
		</cfquery>

	</cffunction>


</cfcomponent>